{% extends "adibilisadminBundle::layout.html.twig" %}
 
{% block title %}
  {{ entity.title }} - Détails article - {{ parent() }}
{% endblock %}

{% block adibilisadmin_body %}

{% if app.session.hasFlash('info') %}
        <div class="alert alert-success">
            {{ app.session.flash('info') }}
        </div>
{% endif %}




</br>



        <section class="blog blog1">
            <div class="container">
                <div class="row">
                    <div class="span12">
                        <article>
                            <div class="row">
                                        {% if  entity.image!= null %}
                                        <center> <img src="/adibilis/web/uploads/img/articles/{{ entity.image.id }}.{{ entity.image.url }}"  width="500px" class="img-polaroid" /> </center> </br>
                                        {% endif %}
                                <div class="span1">
                                    <div class="post-date">
                                        <div class="month">{{ entity.date| localizeddate('medium', 'none', 'en') }}</div>
                                    </div> 
                                </div> 
                                <div class="span11">
                                    <h3>


                                      {% if app.request.locale == 'fr' %}
                                            {{ entity.title }}
                                      {% endif %}


                                      {% if app.request.locale == 'en' %}
                                            {{ entity.titleen }}
                                      {% endif %}


                                      {% if app.request.locale == 'de' %}
                                            {{ entity.titlede }}
                                      {% endif %}


                                    </h3>      
                                </div> 
                                <div class="span12">                                                        
                                    <div class="article_meta">
                                  <ul class="meta-list">
                                     <li><a href=""><span class="icon-user"></span>{{ entity.author.username }}</a></li>
                                     <li><a href=""><span class="icon-comments"></span> {{nbComments}} {{ 'comment.names'|trans }}</a></li>
                                    </ul>
                                </div>

                                      {% if app.request.locale == 'fr' %}
                                            {{ entity.content | raw }}
                                      {% endif %}


                                      {% if app.request.locale == 'en' %}
                                            {{ entity.contenten | raw }}
                                      {% endif %}


                                      {% if app.request.locale == 'de' %}
                                            {{ entity.contentde | raw }}
                                      {% endif %}


                                </div>
                            </div>
                        </article> 
                        <hr>




   <div class="well comment-box">
        <div class="comment-header">
            <div class="row">
                <div class="span1">
                     <span><i class="icon-comments"></i></span>
                </div>
                <div class="span5">
                    <h4>{{nbComments}} {{ 'comment.names'|trans }}</h4>
                </div>
            </div>     
        </div>                            
        <hr>
        <ul class="media-list">


          {% for comment in comments %}

            <li class="media">
                <a class="pull-left" href="#">
                    <img class="media-object img-polaroid" src="/adibilis/web/img/round/avatar.png">
                </a>
                <div class="media-body">
                    <h6 class="media-heading">{{ comment.user.username }} <br> <small> {{ comment.date| localizeddate('full', 'none', 'en') }} - {{ comment.date| localizeddate('none', 'short', 'en') }} </small></h6>
                    <p> «  {{ comment.content }} »</p>


                          {% if is_granted('ROLE_ADMIN') %}


                               <a href="{{ path('article_deletecomment', { 'idArticle': entity.id, 'idComment': comment.id }) }}" class="btn">
                            <i class="icon-trash"></i>
                            Supprimer
                          </a>


                          {% endif %}
                    <!-- Nested media object -->
                  
                </div>
            </li>
              {% endfor %}

              <hr>

              <div class="comment-header">
            <div class="row">
                <div class="span1">
                     <span><i class="icon-comment"></i></span>
                </div>
                <div class="span5">
                    <h4>{{ 'comment.leave'|trans }} <br> <small>{{ 'comment.give_opinion'|trans }}</small></h4>
                </div>
            </div>     
        </div>
        </br></br>
        


           {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_USER')  %}


          
            <form method="post" {{ form_enctype(form) }}>
              {{ form_widget(form) }}
              </br>
              <input type="submit" value="{{ 'comment.submit'|trans }}" class="btn btn-primary" />
            </form>
          

        {% else %}

        {{ 'comment.connect'|trans }}  <a href="{{ path('fos_user_security_login') }}"> {{ 'comment.connect2'|trans }} </a> {{ 'comment.connect3'|trans }}
        </br> </br>

              {% endif %}              


        </ul>

        </div>               
        <hr>









</br>
</br>

        <a href="{{ path('article', {'page': 1}) }}" class="btn">
      <i class="icon-chevron-left"></i>
      {{ 'layout.buttons.back'|trans }}
    </a>
{% if is_granted('ROLE_ADMIN') %}
        <a href="{{ path('article_edit', {'id': entity.id}) }}" class="btn">
      <i class="icon-edit"></i>
      {{ 'layout.buttons.modify'|trans }}
    </a>
    </br></br>

        <form action="{{ path('article_delete', { 'id': entity.id }) }}" method="post">
            {{ form_widget(delete_form) }}
            <button type="submit" class="btn btn-danger">{{ 'layout.buttons.delete'|trans }}</button>
        </form>
{% endif %}
               
                    </div>
          
          
          
                

            
                    </div>
                </div>     
            </div>
        </section>     
        <!-- End blog -->   



{% endblock %}